package model;
// Generated 15/10/2011 23:08:22 by Hibernate Tools 3.2.1.GA


import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import com.sun.xml.bind.CycleRecoverable;

@Entity
@Table(name="empresa"
    ,catalog="ws_elixo"
)


public class Empresa  implements java.io.Serializable, CycleRecoverable {


     private long idEmpresa;
     private String cnpj;
     private String nomeFantasia;
     private String razaoSocial;
     private String endereco;
     private String nrEndereco;
     private String cep;
     private String telefone;
     private String fax;
     private String email;
     private String site;
     private Set<EmpTipoLixo> empTipoLixos = new HashSet<EmpTipoLixo>(0);

    public Empresa() {
    }


    public Empresa(long idEmpresa, String cnpj, String nomeFantasia, String razaoSocial, String endereco, String cep) {
        this.idEmpresa = idEmpresa;
        this.cnpj = cnpj;
        this.nomeFantasia = nomeFantasia;
        this.razaoSocial = razaoSocial;
        this.endereco = endereco;
        this.cep = cep;
    }
    public Empresa(long idEmpresa, String cnpj, String nomeFantasia, String razaoSocial, String endereco, String nrEndereco, String cep, String telefone, String fax, String email, String site, Set<EmpTipoLixo> empTipoLixos) {
       this.idEmpresa = idEmpresa;
       this.cnpj = cnpj;
       this.nomeFantasia = nomeFantasia;
       this.razaoSocial = razaoSocial;
       this.endereco = endereco;
       this.nrEndereco = nrEndereco;
       this.cep = cep;
       this.telefone = telefone;
       this.fax = fax;
       this.email = email;
       this.site = site;
       this.empTipoLixos = empTipoLixos;
    }

     @Id

    @Column(name="ID_EMPRESA", unique=true, nullable=false)
    public long getIdEmpresa() {
        return this.idEmpresa;
    }

    public void setIdEmpresa(long idEmpresa) {
        this.idEmpresa = idEmpresa;
    }

    @Column(name="CNPJ", nullable=false, length=14)
    public String getCnpj() {
        return this.cnpj;
    }

    public void setCnpj(String cnpj) {
        this.cnpj = cnpj;
    }

    @Column(name="NOME_FANTASIA", nullable=false, length=100)
    public String getNomeFantasia() {
        return this.nomeFantasia;
    }

    public void setNomeFantasia(String nomeFantasia) {
        this.nomeFantasia = nomeFantasia;
    }

    @Column(name="RAZAO_SOCIAL", nullable=false, length=100)
    public String getRazaoSocial() {
        return this.razaoSocial;
    }

    public void setRazaoSocial(String razaoSocial) {
        this.razaoSocial = razaoSocial;
    }

    @Column(name="ENDERECO", nullable=false, length=150)
    public String getEndereco() {
        return this.endereco;
    }

    public void setEndereco(String endereco) {
        this.endereco = endereco;
    }

    @Column(name="NR_ENDERECO", length=10)
    public String getNrEndereco() {
        return this.nrEndereco;
    }

    public void setNrEndereco(String nrEndereco) {
        this.nrEndereco = nrEndereco;
    }

    @Column(name="CEP", nullable=false, length=8)
    public String getCep() {
        return this.cep;
    }

    public void setCep(String cep) {
        this.cep = cep;
    }

    @Column(name="TELEFONE", length=11)
    public String getTelefone() {
        return this.telefone;
    }

    public void setTelefone(String telefone) {
        this.telefone = telefone;
    }

    @Column(name="FAX", length=11)
    public String getFax() {
        return this.fax;
    }

    public void setFax(String fax) {
        this.fax = fax;
    }

    @Column(name="EMAIL", length=50)
    public String getEmail() {
        return this.email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Column(name="SITE", length=50)
    public String getSite() {
        return this.site;
    }

    public void setSite(String site) {
        this.site = site;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="empresa")
    public Set<EmpTipoLixo> getEmpTipoLixos() {
        return this.empTipoLixos;
    }

    public void setEmpTipoLixos(Set<EmpTipoLixo> empTipoLixos) {
        this.empTipoLixos = empTipoLixos;
    }

    @Override
    public Object onCycleDetected(Context cntxt) {
        System.out.println("CycleRecoverable.onCycleDetected # ".concat(this.toString()));
        Empresa n = new Empresa();
        n.setIdEmpresa(this.getIdEmpresa());
        return n;
    }


}



